<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/2/13
 * Time: 18:23
 */

namespace app\controller;

use app\controller\CommonController;
use rap\web\Request;

class OcrController
{

    public function getOCRData (Request $request, $img,$type) {
            if ($type == 1) {
                $category = 'drving';
            } else {
                $category = 'jiazhao';
            }
            $res = CommonController::getOcrData($img, $category);

            return CommonController::success($res);
    }

    public function getUserCarNumberInfo ($img) {

        $common = new CommonController();
        $img = 'http://file.bihuapp.com/lingmu.jpg';
        $imageInfo = getimagesize($img);

        $img = $base64_image = 'data:' . $imageInfo['mime'] . ';base64,' . chunk_split(base64_encode(file_get_contents($img)));

        $res = $common->getCarNumberInfo($img);


        return $res;
    }
}